namespace Collaboris.Saf.Actions.Moss.Tests.Generated
{
    using Engine.Report;

    using Entities;

    using Microsoft.SharePoint.Publishing;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    using Moss.Publishing;

    using Saf.Tests;

    using SharePoint.Moss.Publishing;
    using SharePoint.Wss.Files;

    [TestClass]
    public class SetAvailablePageLayoutTest
    {
        #region Public Methods

        /// <summary>
        /// This test was originally generated but has now been tested and verfiied by MJ
        /// </summary>
        [TestMethod]
        public void SetAvailablePageLayout_Test()
        {
            var setavailablepagelayout =
                new TestAssistant<SetAvailablePageLayout, SiteAndPage>(
                    TestEnvironment.PublishingSite, "SetAvailablePageLayoutTestWeb", "BLANKINTERNET#0");

            using (setavailablepagelayout)
            {

                SPFileHelper.CopyFile(setavailablepagelayout.TestSite.Url + @"/_catalogs/masterpage/WelcomeLinks.aspx",
                    setavailablepagelayout.TestSite.Url + @"/_catalogs/masterpage/WelcomeLinks2.aspx", true, false);

                setavailablepagelayout.FirstEntity.PageName = @"WelcomeLinks2.aspx";
                PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(setavailablepagelayout.TestWeb);
                
                MacroReport doReport = setavailablepagelayout.DoMacro();

                Assert.IsTrue(PageLayoutHelper.IsLayoutAvailable(publishingWeb, "WelcomeLinks2.aspx"));
                
                MacroReport unDoReport = setavailablepagelayout.UndoMacro();

                Assert.IsFalse(PageLayoutHelper.IsLayoutAvailable(publishingWeb, "WelcomeLinks2.aspx"));
            }
        }

        #endregion
    }
}